package com.aeye.mbr.common.plugin.sequence;

import org.springframework.jdbc.core.JdbcTemplate;


/**
 * Created by shengpeng on 2018/3/1.
 */
public class OracleSequenceGenerator implements SequenceGenerator{
    private JdbcTemplate jdbcTemplate;

    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    @Override
    public long getSequence(String seqName) {
        return jdbcTemplate.queryForObject("select " + seqName + ".nextval from dual",Long.class);
    }
}
